package com.excilys.capicsoubank.services.impl;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.excilys.capicsoubank.entities.User;
import com.excilys.capicsoubank.services.UserService;

/**
 * Implémentation du service gérant les utilisateurs.
 * 
 * @author Nicolas Poirier
 */
@Service
@Transactional(readOnly = true)
public class UserServiceImpl implements UserService {

	@Override
	public User getConnectedUser() {
		return (User) SecurityContextHolder.getContext().getAuthentication()
				.getPrincipal();
	}
}
